import axios from "axios";

const baseURL = "/basice/api";

const service = axios.create({
  // 设置请求的基础地址
  baseURL,
  timeout: 5000, // request timeout
});
service.interceptors.request.use((config) => {
  // console.log(config);
  return config;
});
service.interceptors.response.use(
  (res) => {
    if (res.data.code === 10000) {
      return Promise.resolve(res.data.data);
    } else {
      return Promise.reject(res.data.msg);
    }
  },
  (error) => {
    return Promise.reject(error);
  }
);
export default service;
